15. 从零开始编写combineReducers()

const combineReducers = (reducers) => {
  return (state = {}, action) => {
    return Object.keys(reducers).reduce(
      (nextState, key) => {
       nextState[key] = reducers[key](
         state[key],
         action
       );
       return nextState;
      },
      {}
    );
  };
};

combineReducers({todos,visibilityFilter});

//最终代码:http://jsbin.com/vifemew/edit?html,js,console

array.reduce()说明